package com.ds.infrastructure.hyperspace.container.flow.operation;

import com.ds.infrastructure.hyperspace.common.flow.DuplexFlowContext;
import com.ds.infrastructure.hyperspace.container.endpoint.connector.HyperspaceConnector;

/**
 * @author  Weishaoying
 */
public interface EntryFlowOperation<C extends DuplexFlowContext> extends FlowOperation<C> {

    /**
     * Handle input data
     * @param hyperspaceConnector
     * @param duplexFlowContext
     * @param data
     */
    void handleInput(HyperspaceConnector hyperspaceConnector, C duplexFlowContext, Object data);

    /**
     * No more things for this request
     * @param hyperspaceConnector
     * @param duplexFlowContext
     */
    void handleInputComplete(HyperspaceConnector hyperspaceConnector, C duplexFlowContext);

    /**
     * Notified by entry channel active
     * @param endpointNamespace
     */
    void handleChannelActive(String endpointNamespace);

    /**
     * Notified by entry channel inactive
     * @param endpointNamespace
     * @param duplexFlowContext
     */
    void handleChannelInactive(String endpointNamespace, C duplexFlowContext);

    /**
     * Notified by occur exception
     * @param duplexFlowContext
     * @param cause
     */
    void handleExceptionCaught(C duplexFlowContext, Throwable cause);

}
